package com.hz.ruoyilgorder.rabbitmq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MessageProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    // 发送消息到指定队列
    public void sendToQueue(String message) {
        rabbitTemplate.convertAndSend("canal.queue", message);
    }
}
